import 'package:freezed_annotation/freezed_annotation.dart';

part 'shopping_cart_model.freezed.dart';

part 'shopping_cart_model.g.dart';

@freezed
class ShoppingCartModel with _$ShoppingCartModel {
  const factory ShoppingCartModel({
    @Default([]) List<ShoppingCartValidsModel> valids,
  }) = _ShoppingCartModel;

  factory ShoppingCartModel.fromJson(Map<String, dynamic> json) => _$ShoppingCartModelFromJson(json);
}

@freezed
class ShoppingCartValidsModel with _$ShoppingCartValidsModel {
  const factory ShoppingCartValidsModel({
    required String attrsText,
    required String id,
    required String? discount,
    required bool isCollect,
    required bool isEffective,
    required String name,
    required String nowOriginalPrice,
    required String nowPrice,
    required String picture,
    required int postFee,
    required String price,
    required String skuId,
    required bool selected,
    required int count,
    @Default([]) List<ShoppingCartValidsSpecsModel> specs,
  }) = _ShoppingCartValidsModel;

  factory ShoppingCartValidsModel.fromJson(Map<String, dynamic> json) => _$ShoppingCartValidsModelFromJson(json);
}

@freezed
class ShoppingCartValidsSpecsModel with _$ShoppingCartValidsSpecsModel {
  const factory ShoppingCartValidsSpecsModel({
    required String name,
    required String valueName,
  }) = _ShoppingCartValidsSpecsModel;

  factory ShoppingCartValidsSpecsModel.fromJson(Map<String, dynamic> json) =>
      _$ShoppingCartValidsSpecsModelFromJson(json);
}

@freezed
class GetShoppingCartCountModel with _$GetShoppingCartCountModel {
  const factory GetShoppingCartCountModel({
    required int count,
  }) = _GetShoppingCartCountModel;

  factory GetShoppingCartCountModel.fromJson(Map<String, dynamic> json) => _$GetShoppingCartCountModelFromJson(json);
}

@freezed
class GetGuessYouLikeModel with _$GetGuessYouLikeModel {
  const factory GetGuessYouLikeModel({
    @Default([]) List<GetGuessYouLikeResult> result,
  }) = _GetGuessYouLikeModel;

  factory GetGuessYouLikeModel.fromJson(Map<String, dynamic> json) => _$GetGuessYouLikeModelFromJson(json);
}

@freezed
class GetGuessYouLikeResult with _$GetGuessYouLikeResult {
  const factory GetGuessYouLikeResult({
    required String desc,
    required String id,
    required String name,
    required String picture,
    required String price,
    required int orderNum,
  }) = _GetGuessYouLikeResult;

  factory GetGuessYouLikeResult.fromJson(Map<String, dynamic> json) => _$GetGuessYouLikeResultFromJson(json);
}
